<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->id();
            $table->integer('type')->comment('新闻类型');
            $table->string('title')->comment('新闻标题');
            $table->string('image')->comment('新闻图片');
            $table->string('description')->comment('新闻描述');
            $table->string('content')->comment('新闻内容');
            $table->json('links')->nullable()->comment('新闻附件');
            $table->tinyInteger('hide')->default(0)->comment('是否隐藏');
            $table->integer('orderby')->default(0)->comment('排序');
            $table->integer('readnum')->default(0)->comment('阅读量');
            $table->timestamp('published_at')->default(now())->comment('新闻发布时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
